from PySFML import sf
import sys, os
from animation import animation_single

import image
import camera

class interface (object) :
    def __init__ (self, tower) :
        self.tower = tower
        self.clock = animation_single (image.load ('clock.png'))
        self.clock.set_position (0 , 0)
        self.stars = []
        self.stars.append (animation_single (image.load ('star_empty.png')))
        self.stars.append (animation_single (image.load ('star_empty.png')))
        self.stars.append (animation_single (image.load ('star_empty.png')))
        self.stars.append (animation_single (image.load ('star_empty.png')))
        self.stars.append (animation_single (image.load ('star_empty.png')))
        self.font = sf.Font ()
        self.font.LoadFromFile (os.path.join ("data", "DejaVuSans.ttf"), 12)
        self.text = sf.String ("Money: $250000 Population: 0", self.font, 12)
        self.text.SetPosition (65, 40)
        i = 0
        self.camera = camera.camera ()
        for star in self.stars :
            star.set_position (60 + i, 0)
            i += 40
    def update (self, dt, time) :
        pass
    def set_star (self, star) :
        anim = self.stars[star]
        del anim
        self.stars[star] = animation_single (image.load ('star.png'))
        self.stars[star].set_position (60 + star * 40, 0)
    def draw (self) :
        self.camera.draw_sprite_ignore (self.clock)
        for star in self.stars :
            self.camera.draw_sprite_ignore (star)
        self.camera.draw_text_ignore (self.text)
